import { Component, OnInit } from '@angular/core';
import { GlobalService } from '../../global/global.service';
import { TaskService } from './../../data/task.service';

@Component({
	selector: 'app-task',
	templateUrl: './task.component.html',
	styleUrls: ['./task.component.less']
})
export class TaskComponent implements OnInit {

	taskItems = [];
	headModule = {
		totalReward: 0,
		reward: 0,
		readNum: 0
	};
	constructor(private globalService: GlobalService, private taskService: TaskService) { }

	ngOnInit() {
		this.globalService.setMessageText(true, '这是任务中心的消息');
		this.getTaskList();
	}
	getTaskList() {
		this.taskService.tasks().subscribe((response) => {
			console.log(response);
			this.taskItems = response.list;
			this.headModule = {
				totalReward: response.totalReward,
				reward: response.reward,
				readNum: response.readNum
			};
		});
	}
	redirctDetal(taskItem) {

	}

}
